//题目101：判断是否是对称二叉树
//给你一个二叉树的根节点 root ， 检查它是否轴对称。
#include <stdlib.h>
#include <stdbool.h>

//Definition for a binary tree node.
 struct TreeNode {
     int val;
     struct TreeNode *left;
    struct TreeNode *right;
};

bool compare(struct TreeNode* left,struct TreeNode* right)
{
    if(left == NULL && right == NULL)return true;
    if(left == NULL || right == NULL)return false;
    if(left -> val != right -> val) return false;
    return compare(left -> left,right -> right) && compare(left -> right,right -> left);
}

bool isSymmetric(struct TreeNode* root)
{
    if(root == NULL)return false;
    return compare(root -> left,root -> right);
}